package com.hkts.beltweigher.salve.controller;


    import com.alibaba.fastjson.JSON;
    import java.util.List;
    import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
    import com.hkts.beltweigher.utils.CustomPageUtils;
            import org.springframework.web.bind.annotation.RequestMethod;
            import org.springframework.web.bind.annotation.RestController;
        import org.springframework.web.bind.annotation.RequestMapping;
        import org.springframework.beans.factory.annotation.Autowired;
        import org.springframework.web.bind.annotation.ResponseBody;
        import org.springframework.web.bind.annotation.GetMapping;
        import org.slf4j.Logger;
        import org.slf4j.LoggerFactory;
        import com.hkts.beltweigher.utils.Result;
        import com.hkts.beltweigher.utils.ResultUtil;
        import com.hkts.beltweigher.salve.service.ITemperatureRegulationItemService;
        import com.hkts.beltweigher.salve.entity.TemperatureRegulationItem;

/**
 *
 * @author hml
 * @since 2024-11-19
 */
@RestController
@RequestMapping("/order/temperatureRegulationItem")
public class TemperatureRegulationItemController {
private final Logger logger=LoggerFactory.getLogger(TemperatureRegulationItemController.class);

@Autowired
public ITemperatureRegulationItemService iTemperatureRegulationItemService;

/**
 * 分页查询数据
 *
 * @param page  分页信息
 * @param temperatureRegulationItem 查询条件
 * @return
 */
@ResponseBody
@GetMapping("/getTemperatureRegulationItemPageList")
public Result<Object> gettemperatureRegulationItemList(Page<TemperatureRegulationItem> page,TemperatureRegulationItem temperatureRegulationItem){
        return ResultUtil.data(CustomPageUtils.getCustomPage(iTemperatureRegulationItemService.selectPage(page, temperatureRegulationItem)));
        }
/**
 * 保存和修改公用的
 * @param temperatureRegulationItem 传递的实体
 * @return saveOrUpdate
 */
@ResponseBody
@RequestMapping(method = RequestMethod.POST, value = "/temperatureRegulationItemSave")
public Result<Object> temperatureRegulationItemSave(TemperatureRegulationItem temperatureRegulationItem){
        iTemperatureRegulationItemService.saveOrUpdate(temperatureRegulationItem);
        return ResultUtil.success("保存成功");
        }

/**
* 根据id获取对象
*
* @param id 实体ID
* @return 0 失败  1 成功
*/
@ResponseBody
@RequestMapping(method = RequestMethod.GET, value = "/temperatureRegulationItemGetById")
public Result<Object> temperatureRegulationItemGetById(String id){
    TemperatureRegulationItem byId=iTemperatureRegulationItemService.getById(id);
        return ResultUtil.data(byId);
        }

/**
 * 根据id删除对象
 * @param id  实体ID
 * @return 0 失败  1 成功
 */
@ResponseBody
@RequestMapping(method = RequestMethod.POST, value = "/temperatureRegulationItemDelete")
public Result<Object> temperatureRegulationItemDelete(String id){
        iTemperatureRegulationItemService.removeById(id);
        return ResultUtil.success("删除成功");
        }
/**
 * 批量删除对象
 * @param item 实体集合ID
 * @return  0 失败  1 成功
 */
@ResponseBody
@RequestMapping(method = RequestMethod.POST, value = "/temperatureRegulationItemBatchDelete")
public Result<Object> deleteBatchIds(String item){
        List<String> ids=(List<String>)JSON.parse(item);
        iTemperatureRegulationItemService.removeByIds(ids);
        return ResultUtil.success("删除成功");
        }

        }
